package com.landian.commons.jpa.hql;


/**
 * PredicateHqlLike
 *
 * @author caojl
 * @create 2017/12/06
 **/
class PredicateHqlCommon implements PredicateHql {

    private PredicateHqlCommon(String path, ParameterUnit parameterUnit, OperationType operationType){
        this.path = path;
        this.parameterUnit = parameterUnit;
        this.operationType = operationType;
    }

    /**
     * path
     */
    private OperationType operationType;

    /**
     * parameterUnit
     */
    private ParameterUnit parameterUnit;

    /**
     * path
     */
    private String path;


    public static PredicateHql newInstance(String path, ParameterUnit parameterUnit, OperationType operationType) {
        return new PredicateHqlCommon(path, parameterUnit, operationType);
    }

    @Override
    public String hql() {
        return path + " " + operationType.getKey() + " " + HQLConstants.KEY_COLON + parameterUnit.getName();
    }

    @Override
    public ParameterUnit parameterUnit() {
        return parameterUnit;
    }
}
